/*
 * @Author: 吴世扬 18368095041@163.com
 * @Date: 2025-06-04 15:05:26
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2025-06-04 15:09:40
 * @FilePath: /vue3-uniapp/src/service/useEnum/modules/index.ts
 */
import {
    Subject,
    debounceTime,
    switchMap,
    from,
    shareReplay,
    map,
    Observable
} from 'rxjs';

import { readDictType } from '@/api/common';

import type { EnumItem } from '../type';
import { generateSource } from '../utils';

export const validTypes: EnumItem[] = [
    {
        label: '有效',
        value: 1
    },
    {
        label: '无效',
        value: 0
    }
];
export const severityTypes: EnumItem[] = [
    {
        value: 1,
        label: '普通'
    },
    {
        value: 2,
        label: '重要'
    },
    {
        value: 3,
        label: '重大紧急'
    }
];
export const satisfyTypes: EnumItem[] = [
    {
        value: 1,
        label: '满意'
    },
    {
        value: 2,
        label: '不满意'
    },
    {
        value: 3,
        label: '待评价'
    }
];

export const orderSourceTypesSubject = new Subject();
export const orderSourceTypesSource = generateSource(
    orderSourceTypesSubject,
    () => readDictType('orderSourceType'),
    'value',
    'key'
);

export const orderStatusTypesSubject = new Subject();
export const orderStatusTypesSource = generateSource(
    orderStatusTypesSubject,
    () => readDictType('orderStatus'),
    'value',
    'key'
);

export const appealTypeCodeTypesSubject = new Subject();
export const appealTypeCodeTypesSource = generateSource(
    appealTypeCodeTypesSubject,
    () => readDictType('appealTypeCode'),
    'value',
    'key'
);
